<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>基于Ajax灾区物资运输管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/xadmin.css">
    <script src="../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">日志管理</div>
                <div class="layui-card-body ">
                    <div class="layui-card-body ">
                        <form class="layui-form layui-col-space5">
                            <div class="layui-inline layui-show-xs-block">
                                <input type="text" name="startTime" id="start" placeholder="请输入开始时间" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-inline layui-show-xs-block">
                                <input type="text" name="endTime" id="end" placeholder="请输入结束时间" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-inline layui-show-xs-block">
                                <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon">&#xe615;</i></button>
                            </div>
                        </form>
                    </div>
                    <div class="layui-card-body layui-table-body layui-table-main">
                        <table class="layui-table layui-form" id="table-demo" lay-filter="table-demo"></table>
                    </div>
                    <script type="text/html" id="barDemo">
                        <a class="layui-btn layui-btn-xs" lay-event="reset">重置密码</a>
                        {{# if(d.accountStatus == '1'){ }}
                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="stop">账号禁用</a>
                        {{# }else{  }}
                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="stop">账号启用</a>
                        {{# } }}
                    </script>
                    <script type="text/html" id="statusTpl">
                        {{# if(d.accountStatus == '1'){ }}
                        <span style="color: #1AA094;">已启用</span>
                        {{# }else{  }}
                        <span style="color: #ff0000;">已禁用</span>
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/xcity.js"></script>
<script>
    layui.use(['laydate','form', 'table'], function(){
        var laydate = layui.laydate;
        var  form = layui.form;
        var table = layui.table;
        var account = JSON.parse(window.sessionStorage.getItem("account"));

        table.render({
            elem: "#table-demo",
            url: './manage/queryLogsInfo',
            id: 'table-search',
            page: true,
            method: 'post',
            cols:[
                [
                    {field: 'id', title: 'ID', width:100, fixed: 'left'}
                    ,{field: 'logAccountName', title: '账号名', width:100}
                    ,{field: 'logInfo', title: '日志信息', width:150}
                    ,{field: 'logIp', title: '日志IP', width:150}
                    ,{field: 'logTime', title: '日志时间', width:180}
                ]
            ]
        });

        // 查询搜索
        form.on('submit(search)', function(data) {
            // table-search 对应上方定义table.render({id: 'table-search'})
            table.reload("table-search", {
                url: './manage/queryLogsInfo',
                method: 'post',
                where: {
                    startTime: data.field.startTime,
                    endTime: data.field.endTime
                },
                page: {
                    curr: 1
                }
            });
            return false;
        });

        // 监听全选
        form.on('checkbox(checkall)', function(data){
            if(data.elem.checked){
                $('tbody input').prop('checked',true);
            }else{
                $('tbody input').prop('checked',false);
            }
            form.render('checkbox');
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#start', //指定元素
            type: 'datetime'
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end', //指定元素
            type: 'datetime'
        });

    });

</script>
</html>
